.class final Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;
.super Lcom/burstly/lib/component/networkcomponent/burstly/html/VideoViewPane;
.source "RewardsVideoView.java"

# interfaces
.implements Ljava/lang/Runnable;
.implements Landroid/media/MediaPlayer$OnPreparedListener;
.implements Landroid/media/MediaPlayer$OnErrorListener;
.implements Landroid/media/MediaPlayer$OnCompletionListener;
.implements Ljava/util/concurrent/ThreadFactory;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;
    }
.end annotation


# instance fields
.field private mExecutor:Ljava/util/concurrent/ScheduledExecutorService;

.field private mOnCompletionListener:Landroid/media/MediaPlayer$OnCompletionListener;

.field private mOnErrorListener:Landroid/media/MediaPlayer$OnErrorListener;

.field private mOnPrepListener:Landroid/media/MediaPlayer$OnPreparedListener;

.field private mOriginalVideoUrl:Ljava/lang/String;

.field private volatile mPrepared:Z

.field private mRewardsMediaController:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsMediaController;

.field private volatile mVideoEventsListener:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;


# direct methods
.method constructor <init>(Landroid/content/Context;)V
    .locals 1
    .parameter "context"

    .prologue
    .line 129
    invoke-direct {p0, p1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/VideoViewPane;-><init>(Landroid/content/Context;)V

    .line 86
    invoke-static {p0}, Ljava/util/concurrent/Executors;->newSingleThreadScheduledExecutor(Ljava/util/concurrent/ThreadFactory;)Ljava/util/concurrent/ScheduledExecutorService;

    move-result-object v0

    iput-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mExecutor:Ljava/util/concurrent/ScheduledExecutorService;

    .line 130
    invoke-super {p0, p0, p0, p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/VideoViewPane;->setListeners(Landroid/media/MediaPlayer$OnPreparedListener;Landroid/media/MediaPlayer$OnCompletionListener;Landroid/media/MediaPlayer$OnErrorListener;)V

    .line 131
    return-void
.end method


# virtual methods
.method public destroy()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    .line 155
    invoke-super {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/VideoViewPane;->destroy()V

    .line 156
    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->getVideoView()Landroid/widget/VideoView;

    move-result-object v0

    .line 157
    .local v0, videoView:Landroid/widget/VideoView;
    invoke-virtual {v0, v2}, Landroid/widget/VideoView;->setMediaController(Landroid/widget/MediaController;)V

    .line 158
    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mExecutor:Ljava/util/concurrent/ScheduledExecutorService;

    invoke-interface {v1}, Ljava/util/concurrent/ScheduledExecutorService;->shutdownNow()Ljava/util/List;

    .line 159
    iput-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mExecutor:Ljava/util/concurrent/ScheduledExecutorService;

    .line 160
    iput-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mOnPrepListener:Landroid/media/MediaPlayer$OnPreparedListener;

    .line 161
    iput-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mOnCompletionListener:Landroid/media/MediaPlayer$OnCompletionListener;

    .line 162
    iput-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mOnErrorListener:Landroid/media/MediaPlayer$OnErrorListener;

    .line 163
    return-void
.end method

.method protected bridge synthetic getMediaController()Landroid/widget/MediaController;
    .locals 1

    .prologue
    .line 39
    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->getMediaController()Lcom/burstly/lib/component/networkcomponent/burstly/NoSeekMediaController;

    move-result-object v0

    return-object v0
.end method

.method protected getMediaController()Lcom/burstly/lib/component/networkcomponent/burstly/NoSeekMediaController;
    .locals 2

    .prologue
    .line 187
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mRewardsMediaController:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsMediaController;

    if-nez v0, :cond_0

    .line 188
    new-instance v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsMediaController;

    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsMediaController;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mRewardsMediaController:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsMediaController;

    .line 190
    :cond_0
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mRewardsMediaController:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsMediaController;

    return-object v0
.end method

.method getOriginalVideoUrl()Ljava/lang/String;
    .locals 1

    .prologue
    .line 263
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mOriginalVideoUrl:Ljava/lang/String;

    return-object v0
.end method

.method getVideoEventsListener()Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;
    .locals 1

    .prologue
    .line 171
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mVideoEventsListener:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;

    return-object v0
.end method

.method isPaused()Z
    .locals 1

    .prologue
    .line 254
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mRewardsMediaController:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsMediaController;

    invoke-virtual {v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsMediaController;->isPaused()Z

    move-result v0

    return v0
.end method

.method isPrepared()Z
    .locals 1

    .prologue
    .line 245
    iget-boolean v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mPrepared:Z

    return v0
.end method

.method public newThread(Ljava/lang/Runnable;)Ljava/lang/Thread;
    .locals 1
    .parameter "r"

    .prologue
    .line 195
    new-instance v0, Ljava/lang/Thread;

    invoke-direct {v0, p1}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V

    return-object v0
.end method

.method public onCompletion(Landroid/media/MediaPlayer;)V
    .locals 1
    .parameter "arg0"

    .prologue
    .line 212
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mOnCompletionListener:Landroid/media/MediaPlayer$OnCompletionListener;

    if-eqz v0, :cond_0

    .line 213
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mOnCompletionListener:Landroid/media/MediaPlayer$OnCompletionListener;

    invoke-interface {v0, p1}, Landroid/media/MediaPlayer$OnCompletionListener;->onCompletion(Landroid/media/MediaPlayer;)V

    .line 215
    :cond_0
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mVideoEventsListener:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;

    if-eqz v0, :cond_1

    .line 216
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mVideoEventsListener:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;

    invoke-interface {v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;->ended()V

    .line 218
    :cond_1
    return-void
.end method

.method public onError(Landroid/media/MediaPlayer;II)Z
    .locals 1
    .parameter "arg0"
    .parameter "arg1"
    .parameter "arg2"

    .prologue
    .line 222
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mVideoEventsListener:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;

    if-eqz v0, :cond_0

    .line 223
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mVideoEventsListener:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;

    invoke-interface {v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;->error()V

    .line 225
    :cond_0
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mOnErrorListener:Landroid/media/MediaPlayer$OnErrorListener;

    if-eqz v0, :cond_1

    .line 226
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mOnErrorListener:Landroid/media/MediaPlayer$OnErrorListener;

    invoke-interface {v0, p1, p2, p3}, Landroid/media/MediaPlayer$OnErrorListener;->onError(Landroid/media/MediaPlayer;II)Z

    move-result v0

    .line 228
    :goto_0
    return v0

    :cond_1
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public onPrepared(Landroid/media/MediaPlayer;)V
    .locals 7
    .parameter "arg0"

    .prologue
    .line 200
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mPrepared:Z

    .line 201
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mVideoEventsListener:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;

    if-eqz v0, :cond_0

    .line 202
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mVideoEventsListener:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;

    invoke-interface {v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;->started()V

    .line 204
    :cond_0
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mExecutor:Ljava/util/concurrent/ScheduledExecutorService;

    const-wide/16 v2, 0x0

    const-wide/16 v4, 0x1

    sget-object v6, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;

    move-object v1, p0

    invoke-interface/range {v0 .. v6}, Ljava/util/concurrent/ScheduledExecutorService;->scheduleAtFixedRate(Ljava/lang/Runnable;JJLjava/util/concurrent/TimeUnit;)Ljava/util/concurrent/ScheduledFuture;

    .line 205
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mOnPrepListener:Landroid/media/MediaPlayer$OnPreparedListener;

    if-eqz v0, :cond_1

    .line 206
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mOnPrepListener:Landroid/media/MediaPlayer$OnPreparedListener;

    invoke-interface {v0, p1}, Landroid/media/MediaPlayer$OnPreparedListener;->onPrepared(Landroid/media/MediaPlayer;)V

    .line 208
    :cond_1
    return-void
.end method

.method public playVideo(Ljava/lang/String;)V
    .locals 2
    .parameter "url"

    .prologue
    .line 233
    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-static {v1}, Lcom/burstly/lib/component/networkcomponent/burstly/video/VideoCache;->getInstance(Landroid/content/Context;)Lcom/burstly/lib/component/networkcomponent/burstly/video/VideoCache;

    move-result-object v1

    invoke-virtual {v1, p1}, Lcom/burstly/lib/component/networkcomponent/burstly/video/VideoCache;->hasFileInCache(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 234
    .local v0, cachedUrl:Ljava/lang/String;
    iput-object p1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mOriginalVideoUrl:Ljava/lang/String;

    .line 235
    const/4 v1, 0x0

    iput-boolean v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mPrepared:Z

    .line 236
    if-eqz v0, :cond_0

    .end local v0           #cachedUrl:Ljava/lang/String;
    :goto_0
    invoke-super {p0, v0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/VideoViewPane;->playVideo(Ljava/lang/String;)V

    .line 237
    return-void

    .restart local v0       #cachedUrl:Ljava/lang/String;
    :cond_0
    move-object v0, p1

    .line 236
    goto :goto_0
.end method

.method public run()V
    .locals 3

    .prologue
    .line 143
    invoke-static {}, Lcom/burstly/lib/util/Utils;->lowerCurrentThreadPriority()V

    .line 144
    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->getVideoView()Landroid/widget/VideoView;

    move-result-object v0

    .line 145
    .local v0, videoView:Landroid/widget/VideoView;
    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mVideoEventsListener:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;

    if-eqz v1, :cond_0

    if-eqz v0, :cond_0

    invoke-virtual {v0}, Landroid/widget/VideoView;->isPlaying()Z

    move-result v1

    if-eqz v1, :cond_0

    .line 146
    iget-object v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mVideoEventsListener:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;

    invoke-virtual {v0}, Landroid/widget/VideoView;->getCurrentPosition()I

    move-result v2

    invoke-interface {v1, v2}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;->timeUpdate(I)V

    .line 148
    :cond_0
    return-void
.end method

.method public setListeners(Landroid/media/MediaPlayer$OnPreparedListener;Landroid/media/MediaPlayer$OnCompletionListener;Landroid/media/MediaPlayer$OnErrorListener;)V
    .locals 0
    .parameter "onPrep"
    .parameter "onCompl"
    .parameter "onError"

    .prologue
    .line 136
    iput-object p1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mOnPrepListener:Landroid/media/MediaPlayer$OnPreparedListener;

    .line 137
    iput-object p2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mOnCompletionListener:Landroid/media/MediaPlayer$OnCompletionListener;

    .line 138
    iput-object p3, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mOnErrorListener:Landroid/media/MediaPlayer$OnErrorListener;

    .line 139
    return-void
.end method

.method setVideoEventsListener(Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;)V
    .locals 1
    .parameter "videoEventsListener"

    .prologue
    .line 180
    iput-object p1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mVideoEventsListener:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;

    .line 181
    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->getMediaController()Lcom/burstly/lib/component/networkcomponent/burstly/NoSeekMediaController;

    move-result-object v0

    check-cast v0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsMediaController;

    iput-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mRewardsMediaController:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsMediaController;

    .line 182
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView;->mRewardsMediaController:Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsMediaController;

    invoke-virtual {v0, p1}, Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsMediaController;->setVideoListener(Lcom/burstly/lib/component/networkcomponent/burstly/html/rewards/RewardsVideoView$IVideoEvents;)V

    .line 183
    return-void
.end method
